import DateUtil from "../../engine/DateUtil";
import LocalStorage from "../../engine/LocalStorage";
import { ClubShenheModel } from "../model/ClubShenheModel";



export default class RedDotManager {

    public static instance: RedDotManager = new RedDotManager();

    public static RedDot_Type = {
        Club_shenhe: 1, //俱乐部审核
        Club_shenhe2: 2, //俱乐部审核

    }

    private reddotNodeMap: Map<number, cc.Node> = new Map<number, cc.Node>()

    public registerReddot(id: number, reddotNode: cc.Node) {
        this.reddotNodeMap.set(id, reddotNode)
        this.checkShowReddot(id)
    }

    public checkShowReddot(id: number) {
        let reddotNode: cc.Node = this.reddotNodeMap.get(id)
        if (reddotNode) {
            reddotNode.active = false;
            if (id == RedDotManager.RedDot_Type.Club_shenhe
                || id == RedDotManager.RedDot_Type.Club_shenhe2) {
                this.checkClubShenhe(id)
            }
        }
    }

    public checkShowReddotList(idList: Array<number>) {
        for (let i = 0; i < idList.length; i++) {
            this.checkShowReddot(idList[i])
        }
    }

    private checkClubShenhe(id: number) {
        let reddotNode: cc.Node = this.reddotNodeMap.get(id)
        reddotNode.active = false
        if (ClubShenheModel.modelList.length > 0) {
            reddotNode.active = true
        }
    }



}
